package com.hkbigdata.springbootdemo.service.impl;

import com.hkbigdata.springbootdemo.bean.Employee;
import com.hkbigdata.springbootdemo.mapper.EmployeeMapper;
import com.hkbigdata.springbootdemo.service.EmployeeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author liuanbo
 * @creat 2024-11-13-14:36
 * @see 2194550857@qq.com
 */
@Service
public class EmployeeServiceImpl implements EmployeeService {

    @Autowired
    EmployeeMapper employeeMapper;

    @Override
    public List<Employee> findAll() {
        System.out.println("开始处理核心业务");
        List<Employee> all = employeeMapper.findAll();
        System.out.println("结束处理核心业务");
        return all;
    }

    @Override
    public Employee findById(Integer id) {
        System.out.println("开始处理核心业务");
        Employee mapperById = employeeMapper.findById(id);
        System.out.println("结束处理核心业务");
        return mapperById;
    }

    @Override
    public void add(Employee employee) {
        System.out.println("开始处理核心业务");
        employeeMapper.add(employee);
        System.out.println("结束处理核心业务");

    }

    @Override
    public void deleteById(Integer id) {
        System.out.println("开始处理核心业务");
        employeeMapper.delete(id);
        System.out.println("结束处理核心业务");
    }

    @Override
    public void update(Employee employee) {
        System.out.println("开始处理核心业务");
        employeeMapper.update(employee);
        System.out.println("结束处理核心业务");
    }
}
